package group.sicher.common.entity;

import group.sicher.common.constant.senum.ActivityTypeEnum;
import group.sicher.common.constant.senum.PayStatusEnum;

import javax.persistence.*;
import java.util.Objects;

/**
 * @Auth rock
 * @Date 2019/7/1 21:08
 * @description
 */
@Entity
@Table(name = "wm_shop_activity")
public class ShopActivityEntity {

    private Long id;
    private Long shopId;
    private ActivityTypeEnum type;
    private String target;
    private String cut;
    private PayStatusEnum status;//活动状态 0:关闭 1:开启
    private Long startAt;
    private Long endAt;
    private Long createAt;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "shop_id", nullable = true)
    public Long getShopId() {
        return shopId;
    }

    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }

    @Basic
    @Column(name = "type", nullable = true)
    public ActivityTypeEnum getType() {
        return type;
    }

    public void setType(ActivityTypeEnum type) {
        this.type = type;
    }

    @Basic
    @Column(name = "target", nullable = true, length = 20)
    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    @Basic
    @Column(name = "cut", nullable = true, length = 20)
    public String getCut() {
        return cut;
    }

    public void setCut(String cut) {
        this.cut = cut;
    }

    @Basic
    @Column(name = "status", nullable = true)
    public PayStatusEnum getStatus() {
        return status;
    }

    public void setStatus(PayStatusEnum status) {
        this.status = status;
    }

    @Basic
    @Column(name = "start_at", nullable = true)
    public Long getStartAt() {
        return startAt;
    }

    public void setStartAt(Long startAt) {
        this.startAt = startAt;
    }

    @Basic
    @Column(name = "end_at", nullable = true)
    public Long getEndAt() {
        return endAt;
    }

    public void setEndAt(Long endAt) {
        this.endAt = endAt;
    }

    @Basic
    @Column(name = "create_at", nullable = true)
    public Long getCreateAt() {
        return createAt;
    }

    public void setCreateAt(Long createAt) {
        this.createAt = createAt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ShopActivityEntity that = (ShopActivityEntity) o;
        return id == that.id &&
                Objects.equals(shopId, that.shopId) &&
                Objects.equals(type, that.type) &&
                Objects.equals(target, that.target) &&
                Objects.equals(cut, that.cut) &&
                Objects.equals(status, that.status) &&
                Objects.equals(startAt, that.startAt) &&
                Objects.equals(endAt, that.endAt) &&
                Objects.equals(createAt, that.createAt);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, shopId, type, target, cut, status, startAt, endAt, createAt);
    }
}
